package assignments.sagarjoshi.springtms;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

/**
 * Created by sagar.joshi on 20/1/15.
 */
public class TraineeAdapter extends ArrayAdapter<Trainee>
{
    Trainee[] data;
    public TraineeAdapter(Context context,Trainee[] data)
    {
        super(context,R.layout.trainee_item_layout,data);
        this.data=data;
    }

    public View getView(int pos,View v,ViewGroup parent)
    {
        v= ((LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.trainee_item_layout,null);
        ((TextView)v.findViewById(R.id.v_id)).setText(data[pos].getTrainee_id());
        ((TextView)v.findViewById(R.id.v_name)).setText(data[pos].getTrainee_name());
        ((TextView)v.findViewById(R.id.v_tech)).setText(data[pos].getTechnology());
        return  v;
    }
}
